package com.cnhis.cloudhealth;

import java.util.Timer;
import java.util.TimerTask;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;
import com.cnhis.cloudhealth.clinical.util.CacheService;
import com.cnhis.cloudhealth.clinical.util.GlobalUtil;
import com.cnhis.cloudhealth.clinical.util.GlobalUtil_prjcli;
import com.cnhis.cloudhealth.clinical.util.PiplineUtil;
import com.cnhis.cloudhealth.clinical.util.cache.CacheSpringWzRedis_SafePart;
import com.cnhis.cloudhealth.clinical.util.cache.MybatisCacheWzGuava;
 
import com.cnhis.cloudhealth.clinical.util.cache.connStatChkr;
import com.google.common.base.Function;
import com.google.common.cache.Cache;

/**
 * Created by yangzhengxin on 2015-12-18.
 */
public class ProviderStart {
    public static  void main(String args[]) throws ClassNotFoundException{
    	
    //	 Cache
    //	Jedis
    	final Logger logger = LoggerFactory.getLogger(ProviderStart.class);  
    	 logger.debug("debug()方法，看下这里logger的实例是：{}", logger.getClass());  
         logger.info("info()方法，看下这里logger的实例是：{}", logger.getClass());  
         logger.error("error()方法，看下这里logger的实例是：{}", logger.getClass());  
         
//         Timer tmr=new Timer();
//     	tmr.schedule(new TimerTask() {
// 			
// 			@Override
// 			public void run() {
// 				
// 				//String msg=;
// 				logger.info("---------MybatisCacheWzGuava.Cache1_guava：："+MybatisCacheWzGuava.Cache1_guava.asMap() );
// 				logger.info("---------MybatisCacheWzGuava.Cache1_guava：："+JSON.toJSONString(MybatisCacheWzGuava.Cache1_guava.asMap(), true) );
// 				
// 				System.out.println("---------MybatisCacheWzGuava.Cache1_guava：："+(MybatisCacheWzGuava.Cache1_guava.asMap())); 
// 				System.out.println("---------MybatisCacheWzGuava.Cache1_guava：："+JSON.toJSONString(MybatisCacheWzGuava.Cache1_guava.asMap(), true)); 
// 				
// 			}
// 		}, 50, 5000);
         
      	//load thredline pool
    
 		
 		GlobalUtil_prjcli.loadClass(PiplineUtil.class);
 	 	GlobalUtil_prjcli.loadClass(CacheSpringWzRedis_SafePart.class);  
 		
  	com.alibaba.dubbo.container.Main.main(args);
    	
   
    	
    	changeStockCacheRefresh();
    }

	private static void changeStockCacheRefresh() {
//		GlobalUtil
//		CacheService cacheService = new CacheService();
//		cacheService.CacheRefreshTimer(9000,new   Function<String, Object>() {
//
//			@Override
//			public Object apply(String f) {
//				//some process()
//				System.out.println("CacheRefreshTimer processed:"+f);
//				return null;
//			}
//		} );
//		cacheService.CacheDir="CacheDir_changeStock";
//		cacheService.CacheLogDir="CacheLogDir_changeStockLog";
	}
}
